package com.syqc.monitor.ui.list

import com.syqc.comlib.utils.CacheMMKV


/**
 *@Author Jasper
 *@Time   2020/11/13
 *@Desc   列表监控参数设置
 */
class ListMonitorModel {
    companion object {
        val instance: ListMonitorModel by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
            ListMonitorModel()
        }
    }

    private var isTimeShow: Boolean
    private var isStateShow: Boolean
    private var isSpeedShow: Boolean
    private var isDriverShow: Boolean
    private var isMileShow: Boolean
    private var isRunStopShow: Boolean
    private var isOilShow   : Boolean
    private var isTempShow  : Boolean
    private var isDempShow  : Boolean
    private var isWaterShow : Boolean
    private var isLoadShow  : Boolean

    init {
        isTimeShow = CacheMMKV.decodeBoolean("isTimeShow", true)
        isStateShow = CacheMMKV.decodeBoolean("isStateShow", true)
        isSpeedShow = CacheMMKV.decodeBoolean("isSpeedShow", true)
        isDriverShow = CacheMMKV.decodeBoolean("isDriverShow", true)
        isMileShow = CacheMMKV.decodeBoolean("isMileShow", true)
        isRunStopShow = CacheMMKV.decodeBoolean("isRunStopShow", true)
        isOilShow = CacheMMKV.decodeBoolean("isOilShow", true)
        isTempShow = CacheMMKV.decodeBoolean("isTempShow", true)
        isDempShow = CacheMMKV.decodeBoolean("isDempShow", true)
        isWaterShow = CacheMMKV.decodeBoolean("isWaterShow", true)
        isLoadShow = CacheMMKV.decodeBoolean("isLoadShow", true)
    }

    fun getTimeShow(): Boolean = isTimeShow
    fun getStateShow(): Boolean = isStateShow
    fun getSpeedShow(): Boolean = isSpeedShow
    fun getDriverShow(): Boolean = isDriverShow
    fun getMileShow(): Boolean = isMileShow
    fun getRunStopShow(): Boolean = isRunStopShow
    fun getOilShow  (): Boolean = isOilShow
    fun getTempShow (): Boolean = isTempShow
    fun getDempShow (): Boolean = isDempShow
    fun getWaterShow(): Boolean = isWaterShow
    fun getLoadShow (): Boolean = isLoadShow

    fun setTime(isTimeShow: Boolean) {
        this.isTimeShow = isTimeShow
        CacheMMKV.encode("isTimeShow", isTimeShow)
    }

    fun setState(isStateShow: Boolean) {
        this.isStateShow = isStateShow
        CacheMMKV.encode("isStateShow", isStateShow)
    }

    fun setSpeed(isSpeedShow: Boolean) {
        this.isSpeedShow = isSpeedShow
        CacheMMKV.encode("isSpeedShow", isSpeedShow)
    }

    fun setDriver(isDriverShow: Boolean) {
        this.isDriverShow = isDriverShow
        CacheMMKV.encode("isDriverShow", isDriverShow)
    }

    fun setMile(isMileShow: Boolean) {
        this.isMileShow = isMileShow
        CacheMMKV.encode("isMileShow", isMileShow)
    }

    fun setRunStop(isRunStopShow: Boolean) {
        this.isRunStopShow = isRunStopShow
        CacheMMKV.encode("isRunStopShow", isRunStopShow)
    }

    fun setOilShow(isOilShow: Boolean) {
        this.isOilShow = isOilShow
        CacheMMKV.encode("isOilShow", isOilShow)
    }

    fun setTempShow(isTempShow: Boolean) {
        this.isTempShow = isTempShow
        CacheMMKV.encode("isTempShow", isTempShow)
    }

    fun setDempShow(isDempShow: Boolean) {
        this.isDempShow = isDempShow
        CacheMMKV.encode("isDempShow", isDempShow)
    }

    fun setWaterShow(isWaterShow: Boolean) {
        this.isWaterShow = isWaterShow
        CacheMMKV.encode("isWaterShow", isWaterShow)
    }
    fun setLoadShow(isLoadShow: Boolean) {
        this.isLoadShow = isLoadShow
        CacheMMKV.encode("isLoadShow", isLoadShow)
    }

}